//引入vue、vue路由和相关vue文件
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@views/home'
import About from '@views/about'

Vue.use(VueRouter)
//防止路由跳转报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    console.log('this is location', location);
    return originalPush.call(this, location).catch(err => {
        console.log('报错信息:', err);
        return err;
    })
}

//导出路由
export default new VueRouter({
    routes: [
        {
            path: '*',
            name: 'Home',
            component: Home
        },
        //重定向
        {
            path: '/home',
            name: 'Home',
            component: Home,
            children: [
                
            ]
        },
        {
            path: '/about',
            name: 'About',
            component: About,
            children: [
                
            ]
        }
    ]
    
})
